package com.jcli.jb51_net.article._175980开关按钮;
import javafx.scene.control.Button;

import javax.swing.*;

public class ButtonUtils {
    private static final long CLICK_INTERVAL = 200; // 定义点击间隔时间，单位毫秒

    public static boolean isFastClick(Button button) {
        Object userData = button.getUserData();

        long currentTime = System.currentTimeMillis();
        button.setUserData(currentTime);

        if (userData instanceof Long) {
            Long lastClickTime = (Long) userData;
            return currentTime - lastClickTime <= CLICK_INTERVAL;
        }

        return false;
    }
}
